package Cowquisition;

import java.io.File;
import javax.imageio.ImageIO;
import java.io.IOException;
import java.awt.image.BufferedImage;

/**
 * Cowquisition class
 *
 * The main class for the Cowquisition program
 * @author Ryan Novak, Nick Peterson, Tyler Heil
 */
public class Cowquisition
{
  //This is bad and gross and shut up.
  /** grass Tile version 1 */
  public static Tile grass1;
  /** grass Tile version 2 */
  public static Tile grass2;
  /** water Tile version 1 */
  public static Tile water1;
  /** water Tile version 2 */
  public static Tile water2;
  /** sand Tile version 1 */
  public static Tile sand1;
  /** sand Tile version 2 */
  public static Tile sand2;
  /** dirt Tile version 1 */
  public static Tile dirt1;
  /** dirt Tile version 2 */
  public static Tile dirt2;
  /** swamp Tile version 1 */
  public static Tile swamp1;
  /** swamp Tile version 2 */
  public static Tile swamp2;
  /** lava Tile version 1 */
  public static Tile lava1;
  /** lava Tile version 2 */
  public static Tile lava2;
  /** cow Tile version 1 */
  public static Tile cow1;
  /** cow Tile version 2 */
  public static Tile cow2;
  /** cow Tile version 3 */
  public static Tile cow3;
  /** Image for trees */
  public static BufferedImage tree;
  /** Image for rocks */
  public static BufferedImage rock;
  /** The map */
  public static WorldMap map;
  /** The GUI */
  public static TilePlacement _;
  /** The x size of the map */
  public static final int XSIZE = 100;
  /** The y size of the map */
  public static final int YSIZE = 100;
  
  public static void main(String[] args)
  {
    try
    {
      tree = ImageIO.read(new File("Cowquisition/art/dark_tree.png"));
      rock = ImageIO.read(new File("Cowquisition/art/rock1.png"));
    }
    catch(IOException e)
    {
      System.out.println("NO IMAGE FILE. (for tree or rock)");
    }

    grass1 = new Tile(Tile.landType.GRASS, new File("Cowquisition/art/grass1.png"), true);
    grass2 = new Tile(Tile.landType.GRASS, new File("Cowquisition/art/grass2.png"), true);

    water1 = new Tile(Tile.landType.WATER, new File("Cowquisition/art/water1.png"), false);
    water2 = new Tile(Tile.landType.WATER, new File("Cowquisition/art/water2.png"), false);

    sand1 = new Tile(Tile.landType.SAND, new File("Cowquisition/art/sand1.png"), true);
    sand2 = new Tile(Tile.landType.SAND, new File("Cowquisition/art/sand2.png"), true);

    dirt1 = new Tile(Tile.landType.DIRT, new File("Cowquisition/art/dirt1.png"), true);
    dirt2 = new Tile(Tile.landType.DIRT, new File("Cowquisition/art/dirt2.png"), true);

    swamp1 = new Tile(Tile.landType.SWAMP, new File("Cowquisition/art/swamp1.png"), true);
    swamp2 = new Tile(Tile.landType.SWAMP, new File("Cowquisition/art/swamp2.png"), true);

    lava1 = new Tile(Tile.landType.LAVA, new File("Cowquisition/art/lava1.png"), false);
    lava2 = new Tile(Tile.landType.LAVA, new File("Cowquisition/art/lava2.png"), false);

    cow1 = new Tile(Tile.landType.COW, new File("Cowquisition/art/cow1.png"), false);
    cow2 = new Tile(Tile.landType.COW, new File("Cowquisition/art/cow2.png"), false);
    cow3 = new Tile(Tile.landType.COW, new File("Cowquisition/art/cow3.png"), false);


    MapGen gen = new MapGen(XSIZE, YSIZE, 0);
    gen.generate();
    //gen.print(); //Add for debug
    map = gen.toMapObject();

    
    _ = new TilePlacement();
    _.init(XSIZE, YSIZE);


    (new Thread(new Cow(1))).start();
    (new Thread(new Cow(2))).start();
    (new Thread(new Cow(3))).start();
  }
}
